﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CID.Domain.Operations;

namespace CID.Domain.Exceptions
{
    [Serializable]
    class DuplicateAssignmentException : InvalidActionException
    {
        public DuplicateAssignmentException(IEnvironment environment, IServer server, IServerRole serverRole) 
            : this(environment.GetType().Name, server.GetType().Name, serverRole.GetType().Name) { }
        public DuplicateAssignmentException(IServer server, IEnvironment environment, IServerRole serverRole)
            : this(server.GetType().Name, environment.GetType().Name, serverRole.GetType().Name) { }
        public DuplicateAssignmentException(IServerRole serverRole, IEnvironment environment, IServer server) 
            : this(serverRole.GetType().Name, server.GetType().Name, environment.GetType().Name) { }

        private DuplicateAssignmentException(string targetType, string assignmentType1, string assignmentType2) 
            : base(String.Format("The Assignment of {1} and {2} on to {0} is not possible as it already exists", targetType, assignmentType1, assignmentType2)) { }
    }
}
